package cap4;

public class Punto {

	private float x,y;
	//Constructores
	public Punto (float x,float y){
	  this.x = x;  this.y = y;}
	public void establecerX (float x){
	  this.x = x;}
	public void establecerY (float y){
	  this.x = y;}
	public void copy (Punto p){
	//Require p ligada
	  x = p.obtenerX();
	  y = p.obtenerY();}
	//Consultas
	public float obtenerX(){
	  return x;}
	public float obtenerY(){
	  return y;}
	public double distancia(Punto p) {
	//Require p ligada
	    float dx= x - p.obtenerX();
	    float dy= y - p.obtenerY();
	    return Math.sqrt(dx*dx+dy*dy);}
	public  boolean equals (Punto p){
	//Require p ligada
	  return x==p.obtenerX() && y==p.obtenerY();}
	public Punto clone(){
	 return new Punto(x,y);}
	public String toString(){
	  return "("+x+","+y+")";}
	}
